Free Pascal supports the use of nested comments. The following constructs are valid comments:
(* This is an old style comment *) { This is a Trubo Pascal comment } // This is a Delphi comment. All is ignored till the end of the line.The last line would cause problems when attempting to compile with Delphi or Turbo Pascal. These compiler would consider the first matching brace } as the end of the comment delimiter. If you wish to have this behaviour, you can use the -So switch, and the Free Pascal compiler will act the same way. The following are valid ways of nesting comments:
{ Comment 1 (* comment 2 *) } (* Comment 1 { comment 2 } *) { comment 1 // Comment 2 } (* comment 1 // Comment 2 *) // comment 1 (* comment 2 *) // comment 1 { comment 2 }The last two comments must be on one line. The following two will give errors:
// Valid comment { No longer valid comment !! }and
// Valid comment (* No longer valid comment !! *)The compiler will react with a 'invalid character' error when it encounters such constructs, regardless of the -So switch.